<template>
  <j-modal
    :title="title"
    :width="width"
    :visible="visible"
    switchFullscreen
    :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
    @cancel="close"
    cancelText="关闭">
    <a-card :bordered="false">
      <a-tabs style="margin-top: -20px" @change="tabChange">
        <a-tab-pane key="1" tab="社交奖励">
        </a-tab-pane>
        <a-tab-pane key="2" tab="推广奖励">
        </a-tab-pane>
        <a-tab-pane key="3" tab="充值奖励">
        </a-tab-pane>
        <a-tab-pane key="4" tab="会员奖励">
        </a-tab-pane>
        <a-tab-pane key="5" tab="钻石详情">
        </a-tab-pane>
        <a-tab-pane key="6" tab="后台充值">
        </a-tab-pane>
        <a-tab-pane key="7" tab="后台扣减">
        </a-tab-pane>
      </a-tabs>
      <div>
        <a-table
          ref="table"
          size="middle"
          :scroll="{x:true}"
          rowKey="id"
          :columns="columns"
          :dataSource="dataSource"
          :pagination="ipagination"
          :loading="loading"
          class="j-table-force-nowrap"
          @change="handleTableChange">
          <template slot="statusSlot" slot-scope="text, record">
            <div v-if="record.status === '1'" style="color: #000000">{{text}}</div>
            <div v-else-if="record.status === '2'" style="color: #169bd5">{{text}}</div>
            <div v-else-if="record.status === '3'" style="color: green">{{text}}</div>
            <div v-else style="color: red">{{text}}</div>
          </template>
        </a-table>
      </div>
    </a-card>
  </j-modal>
</template>

<script>

  import '@/assets/less/TableExpand.less'
  import { mixinDevice } from '@/utils/mixin'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'

  export default {
    name: 'DiamondDetailList',
    mixins:[JeecgListMixin, mixinDevice],
    components: {

    },
    data () {
      return {
        description: '用户钻石详情管理页面',
        title:'收益明细',
        width:1200,
        visible: false,
        disableSubmit: true,
        columns:[],
        // 钻石类型表头
        lxColumns: [
          {
            title:'收益',
            align:"center",
            dataIndex: 'changeDiamond',
            customRender:function (t) {
              return "+"+t+"钻石"
            }
          },
          {
            title:'说明',
            align:"center",
            dataIndex: 'changeDetail'
          },
          {
            title:'时间',
            align:"center",
            dataIndex: 'createTime',
          },
        ],
        /**提现表头*/
        txColumns: [
          {
            title:'提现方式',
            align:"center",
            dataIndex: 'payType_dictText'
          },
          {
            title:'提现金额',
            align:"center",
            dataIndex: 'withdrawalAmount',
            customRender:function (t) {
              return t+"元"
            }
          },
          {
            title:'兑换钻石',
            align:"center",
            dataIndex: 'diamondNum',
            customRender:function (t) {
              return t+"钻石"
            }
          },
          {
            title:'到账金额',
            align:"center",
            dataIndex: 'receivedAmount',
            customRender:function (t) {
              return t+"元"
            }
          },
          {
            title:'手续费',
            align:"center",
            dataIndex: 'commission',
            customRender:function (t) {
              return t+"元"
            }
          },
          {
            title:'说明',
            align:"center",
            dataIndex: 'status_dictText',
            scopedSlots: { customRender: 'statusSlot' }
          },
          {
            title:'申请时间',
            align:"center",
            dataIndex: 'createTime'
          },
        ],

        url: {
          list: "/user/diamondDetail/list",
          lxList:"/user/diamondDetail/list",
          txList:"/user/withdrawal/list",
        },
        dictOptions:{},
        superFieldList:[],

        disableMixinCreated:true
      }
    },
    created() {
    },
    computed: {
      importExcelUrl: function(){
        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
      },
    },
    methods: {
      //打开
      open (userId) {
        this.visible=true;
        this.columns=this.lxColumns;
        this.queryParam.userId=userId;
        this.queryParam.changeType="1";//默认查询第一个tab，社交奖励
        this.loadData(1);
      },
      //关闭
      close () {
        this.visible = false;
      },

      //tab切换
      tabChange(key){
        if(key=="5"){
          this.columns=this.txColumns;
          this.url.list=this.url.txList;
          this.queryParam.changeType="";
          this.loadData(1);
        }else{
          this.columns=this.lxColumns;
          this.url.list=this.url.lxList;
          this.queryParam.changeType=key;
          this.loadData(1);
        }

      }
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less';
</style>
